home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 4891 < prev    next >
Encoding:
Text File  |  1996-08-06  |  987 b   |  45 lines

  1. Path: geraldo.cc.utexas.edu!usenet
  2. From: wharris@mail.utexas.edu (W.  Harris)
  3. Newsgroups: comp.lang.c++
  4. Subject: passing struct to constructor  -  temp.txt [1/1]
  5. Date: 1 Feb 1996 13:56:19 GMT
  6. Organization: The University of Texas at Austin
  7. Message-ID: <4eqgq3$5g1@geraldo.cc.utexas.edu>
  8. NNTP-Posting-Host: slip-26-1.ots.utexas.edu
  9. Mime-Version: 1.0
  10. Content-Type: Text/Plain
  11. X-Newsreader: WinVN 0.90.4
  12.  
  13. The compiler error I'm getting is "VIN is not a member of struct1".  The
  14. code has been severely minimized, however this should have the bare 
  15. essentials required to solve the problem.
  16.  
  17. class CarData
  18.     {
  19.     private :
  20.  
  21.     char VIN[7];
  22.  
  23.     public :
  24.  
  25.     CarData(struct astruct1 CarInf);
  26.  
  27.     };
  28.     //********************************************************
  29.  
  30.      CarData::CarData(struct astruct1 CarInf)
  31.       {
  32.       strcpy(VIN,CarInf.VIN);
  33.       }
  34.  
  35.       struct astruct1
  36.     {
  37.     char VIN[7];
  38.     }CarInfo;
  39.  
  40.     void main()
  41.      {
  42.  
  43.      CarData CarConst1(struct astruct1 CarInfo);
  44.      }
  45.